(in-package :webwidgets)

(defun repr (x &key (printer 'prin1))
  "Return a string representation of X by calling PRINTER on X and a
stream. PRINTER defaults to PRIN1."
  (with-output-to-string (stream)
    (funcall printer x stream)))

(defmacro define-restart-function (restart)
  `(defun ,restart (c)
    (declare (ignore c))
      (awhen (find-restart ',restart)
	(invoke-restart it))))